<?php

namespace app\api\model;

use think\Model;

class Image extends BaseModel
{
    protected $hidden = ['id','from','delete_time','update_time'];
//    读取器 get+字段名+Attr
    public function getUrlAttr($value,$data){ // $value:url的值
        /* $finalUrl = $value;
         if ($data['from'] == 1){
             $finalUrl = config('setting.img_prefix').$value;
         }
                 return $finalUrl;*/

//        return $data['from'] == 1 ? config('setting.img_prefix').$value : $value;
        return $this->prefixImgUrl($value,$data);
    }
}
